<%--
  @desc: 应用列表首页
  @author: chenw
  @create: 2014-4-29 下午 15:32
--%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div class="pageHeader">
    <form rel="pageForm" onsubmit="return navTabSearch(this);" action="<c:url value='/sys/role/list'/>" method="post">
        <div class="searchBar">
            <ul>
                <li style="float: left;line-height: 25px;">
                    <label>角色名称：</label>
                    <input name="keywords" type="text" value="${query.keywords}"/>
                </li>
                <li>
                    <div class="buttonActive" style="margin-left:5px;">
                        <div class="buttonContent">
                            <button type="submit">查找</button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
</div>
<div class="pageContent" style="padding-top: 1px;">
    <div class="panelBar">
        <ul class="toolBar" style="float: left;display: inline-block;">
            <li><a class="add" href="<c:url value='/sys/role/new'/>" target="dialog" width="400" height="190" mask="true"
                   resizable="false" maxable="false"><span>添加角色</span></a></li>
            <li class="line"></li>
        </ul>
    </div>
    <table class="table" width="100%" layoutH="114">
        <thead>
        <tr>
            <th width="40" align="center">序号</th>
            <th width="150" orderField="name" <c:if test='${query.orderField eq "name" }'> class="${query.orderDirection}"</c:if>>角色名称</th>
            <th>备注信息</th>
            <th width="80" orderField="sort" <c:if test='${query.orderField eq "sort" }'> class="${query.orderDirection}"</c:if>>排序</th>
            <th width="100">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="role" items="${pager.list}" varStatus="vs">
            <tr>
                <td>${vs.count+(pager.pageNum-1)*pager.numPerPage}</td>
                <td>${role.name}</td>
                <td title="${role.remark}">${role.remark}</td>
                <td>${role.sort}</td>
                <td style="text-indent: 3px;">
                    <a href="<c:url value='/sys/role/view/${role.id}'/>" target="dialog" rel="page_role_edit" width="400" height="190" mask="true"
                       resizable="false" maxable="false" title="角色编辑">编辑</a>&nbsp;
                    <a href="<c:url value='/sys/resource/tree/${role.id}'/>" target="dialog" rel="page_role_res_bind" width="500" height="500"
                       mask="true"
                       resizable="false" maxable="false" title="【${role.name}】角色资源绑定">资源</a>
                    <a href="<c:url value='/sys/role/${role.id}'/>" title="确认删除角色【${role.name}】？" target="ajaxDel"
                       callback="callbackDelRoleRefreshPage">删除</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div class="panelBar">
        <div class="pages">
            <span>显示&nbsp;</span>
            <select id="cob_ps" class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
                <option value="20">20</option>
                <option value="50">50</option>
                <option value="100">100</option>
                <option value="200">200</option>
            </select>
            <span>条，共${pager.total}条</span>
        </div>
        <div class="pagination" targetType="navTab" totalCount="${pager.total}" numPerPage="${pager.numPerPage}" pageNumShown="10"
             currentPage="${pager.pageNum}"></div>
    </div>
    <form id="pagerForm" method="post" action="<c:url value='/sys/role/list'/>">
        <input type="hidden" name="pageNum" value="${pager.pageNum}"/>
        <input type="hidden" name="numPerPage" value="${pager.numPerPage}"/>
        <input type="hidden" name="orderField" value="${query.orderField}"/>
        <input type="hidden" name="orderDirection" value="${query.orderDirection}"/>
    </form>
</div>
<script type="text/javascript">
    function callbackDelRoleRefreshPage(resp) {
        if (resp && resp.succ) {
            alertMsg.info("角色删除成功！");
            $.pdialog.closeCurrent();
            navTab.reloadFlag('page_sys_role_list')
        } else {
            alertMsg.info(resp.msg + "!");
        }
    }
</script>